<template>
  <div class="page">Page is search
    <ul>
      <li v-for="(item) in $store.state.navbar.app" :key="item">{{item}}</li>
      <li v-for="(item, idx) in list" :key="idx">{{item}}</li>
      <li v-for="(item) in list1" :key="item">{{item}}</li>
    </ul>
  </div>
</template>

<script>
import axios from "axios";
export default {
  layout: "search",
  data() {
    return {
      list: [],
      list1: []
    };
  },
  mounted() {
    this.getList2();
  },
  async asyncData() {
    let {
      status,
      data: { list }
    } = await axios.get("http://localhost:3000/city/list");
    if (status === 200) {
      return {
        list
      };
    }
  },
  methods: {
    async getList2() {
      console.log(222);
      let {
        status,
        data: { list }
      } = await axios.get("http://localhost:3000/city/list");
      let list1 = list;
      if (status === 200) {
        this.list1 = list;
      }
    }
  }
};
</script>

<style lang="css">
</style>
